import json
from .SmsSDK import SmsSDK
from django.conf import settings
accId = settings.SMS_INFO.get('ACCID')
accToken = settings.SMS_INFO.get('ACCTOKEN')
appId = settings.SMS_INFO.get('APPID')


def send_message(tid, mobile, datas):
    sdk = SmsSDK(accId, accToken, appId)
    '''
    tid = '1'  #短信模板id
    # mobile = '手机号1,手机号2'  #往哪里发短信
    mobile = '13833013278'
    datas = ('1234', '3')  #
    '''
    resp = sdk.sendMessage(tid, mobile, datas)
    resp = json.loads(resp)
    print(resp) #{"statusCode":"000000","templateSMS":{"smsMessageSid":"1d881afa10084034bc82cfb91720c82f","dateCreated":"20201102090146"}}

    return resp.get('statusCode') == '000000'

# send_message()